#include "LPC17xx.h"
#include "xmodem1k.h"
#include "iap.h"
#include <stdio.h>
#include "bsp_bootloader.h"
#include "uart.h"
uint32_t received_data = 0,time_con = 0;//接收的数据量

uint8_t read_buf[4096] = {0};//用来读取4K数据检测更新标志位使用

uint8_t p = 0;
uint8_t dat = 0;
uint8_t	 send_test = 0;
int main(void)
{
	SystemClockUpdate();
	UARTInit(UART_NUM, BAUD_RATE);
	
	send_test = 0x30;
	UARTSend(UART_NUM, &send_test, 1);
	for(time_con= 0;time_con<100000;time_con++);
	p = *((uint8_t*)0x00004fff);
	if(p == update_iap)	//更新程序
	{
		received_data = 0;					//清空接收寄存器
		get_info();							//获取相关的INFO信息内容
		erase_fun(5,21);					//擦除app区域的flash
		update();							//进入更新程序，
		iap_write_update_flag(update_app);	//标志位写成进入APP
	}
	Boot();
}


